<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:c="http://java.sun.com/jstl/core">
	<!-- imports -->
	<script language="JavaScript" src="../js/FrageHinzufuegen.js"></script>
	<link rel="stylesheet" type="text/css" href="../css/umfrage_table.css"></link>
	<!-- imports -->
	<rich:popupPanel id="answerDetail" autosized="true" modal="true" moveable="true" show="#{AnswerViewBean.showInnerComp}" style="overflow: hidden;">
		<f:facet name="header"><center>Antwort Detail</center></f:facet>
		<center><h:outputLabel value="Antwortbogen löschen/viewen" styleClass="ueberschrift"/></center>
		<h:form id="AnswerView_form">
		<center><hr width="80%"/></center>
		<center><h:outputText value="Antwortbogen zu Umfrage: #{AnswerViewBean.selectedRow.umfrage.bezeichnung}"/></center>
		<center><hr width="80%"/></center>
		<rich:extendedDataTable rowClass="rowstyle_umfrage" id="answer_table" style="overflow: hidden;width:400px;height:300px;margin-right:auto;margin-left:auto;" rows="1" frozenColumns="2" value="#{AnswerViewBean.answersFromSelectedRow}" var="q" rendered="#{sessionManagerBean.userinfo.user.benutzerrolle.bezeichnung.equals('Lehrer')}">
			<rich:column rendered="#{!q.frage.typ.equals('normal')}" width="400px">
				<f:facet name="header">Antwort zu Frage <h:outputText value="#{AnswerViewBean.aktpage}"/><h:outputText value=" von Anonyme" rendered="#{AnswerViewBean.selectedRow.teilnehmer == null}"/><h:outputText value=" von #{AnswerViewBean.selectedRow.teilnehmer.name}" rendered="#{AnswerViewBean.selectedRow.teilnehmer != null}"/></f:facet>
				<table>
					<tr>
						<td>Frage:</td>
						<td></td>
					</tr>
					<tr>
						<td colspan="2"><h:inputTextarea value="#{q.frage.text}" readonly="true" cols="57" rows="3"/></td>
					</tr>
					<tr>
						<td><center><hr width="80%"/></center></td>
					</tr>
					<tr>
						<td>Antworten:</td>
						<td></td>
					</tr>
					<a4j:repeat value="#{AnswerViewBean.aktAnswerpossibilities}" var="ap" >
						
						<tr>
							<td colspan="2"><h:inputTextarea value="#{ap.answerpossibilty.text}" readonly="true" cols="57" rows="1"/></td>
						</tr>
						<tr>
							<td><h:selectBooleanCheckbox value="#{ap.selected}" disabled="true"/></td>
							<td></td>
						</tr>
						
					</a4j:repeat>
				</table>
			</rich:column >
			<rich:column width="400px">
				<f:facet name="header">Antwort zu Frage <h:outputText value="#{AnswerViewBean.aktpage}"/><h:outputText value=" von Anonyme" rendered="#{AnswerViewBean.selectedRow.teilnehmer == null}"/><h:outputText value=" von #{AnswerViewBean.selectedRow.teilnehmer.name}" rendered="#{AnswerViewBean.selectedRow.teilnehmer != null}"/></f:facet>
				<table>
				<tr>
					<td>Frage</td>
					<td></td>
				</tr>
				<tr>
					<td colspan="2"><h:inputTextarea value="#{q.frage.text}" readonly="true" cols="57" rows="3"/></td>
				</tr>
				<tr>
					<td colspan="2"><center><hr width="80%"/></center></td>
				</tr>
				<tr>
					<td>Antwort:</td>
					<td></td>
				</tr>
				<tr>
					<td colspan="2"><h:inputTextarea value="#{q.ftAntwort}"  cols="57" rows="5"/></td>
				</tr>
				</table>
			</rich:column>
		</rich:extendedDataTable>
		<hr width="80%"/>
		<center><rich:dataScroller  rendered="#{sessionManagerBean.userinfo.user.benutzerrolle.bezeichnung.equals('Lehrer')}" render="AnswerView_form"  execute="AnswerView_form" page="#{AnswerViewBean.aktpage}"  id="answer_datascroller" scrollListener="#{AnswerViewBean.pageListener()}" for="answer_table" maxPages="6"/></center>
		<center><h:outputText value="Sie sind Administrator und nicht berechtigt Antworten zu lesen"  rendered="#{sessionManagerBean.userinfo.user.benutzerrolle.bezeichnung.equals('Administrator')}"/></center>
		<hr width="80%"/>
		<table width="100%">
			<tr>
				<td><center><a4j:commandButton onbegin="#{rich:component('Loadingpopup')}.show();" oncomplete="#{rich:component('Loadingpopup')}.hide();#{rich:component('answerDetail')}.hide();" value="Antwortbogen löschen" action="#{AnswerViewBean.DeleteAnswersheet()}" disabled="#{sessionManagerBean.userinfo.user.benutzerrolle.bezeichnung.equals('Lehrer')}" execute="AnswerView_form" render="answerTableForm Messagespopup"/></center></td>
				<td><center><a4j:commandButton onbegin="#{rich:component('Loadingpopup')}.show();" oncomplete="#{rich:component('Loadingpopup')}.hide();#{rich:component('answerDetail')}.hide();" value="abbrechen" action="#{AnswerViewBean.innerCompHide()}" execute="@this" /></center></td>
			</tr>
		</table>
		</h:form>				
		</rich:popupPanel>									
</ui:composition>